<%@ page import="top.majuan.study.javawebjdbc.entity.TbNews" %>
<%@ page import="java.util.List" %>
<%@ page import="top.majuan.study.javawebjdbc.dao.TbNewsDAO" %><%--
  Created by IntelliJ IDEA.
  User: majua
  Date: 2024/5/20
  Time: 18:33
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>新闻列表</title>
</head>
<body>
<%
   List<TbNews> list = TbNewsDAO.query();
%>

<h1>
    <a href="insert.jsp">新闻添加</a>
</h1>

<table>

    <thead>
    <tr>
        <th>编号</th>
        <th>标题</th>
        <th>内容</th>
        <th>发布时间</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    <%
        for (TbNews tbNews : list){
    %>

    <tr>
        <td><%=tbNews.getId()%></td>
        <td><%=tbNews.getTitle()%></td>
        <td><%=tbNews.getContent()%></td>
        <td><%=tbNews.getPublishdate()%></td>
        <td>
            <a href="delete.jsp?id=<%=tbNews.getId()%>">删除</a>
        </td>
    </tr>

    <% } %>
    </tbody>

</table>



</body>
</html>
